<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>学生成绩信息管理系统</title>
    <!-- 自定义title图标 favicon -->
    <link rel="icon" href="/favicon.ico" type="image/png">
    <!-- Bootstrap CSS -->
    <link href="/plugins/bootstrap-4.0.0/css/bootstrap.min.css"  rel="stylesheet">
    <!-- 引入 Font Awesome CSS 文件 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" >
    <!-- 自定义样式 -->
    <link href="/helps/css/bottom.css" rel="stylesheet">
    <style type="text/css">
        /* Chart.js */

        @-webkit-keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        @keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        .chartjs-render-monitor {
            -webkit-animation: chartjs-render-animation 0.001s;
            animation: chartjs-render-animation 0.001s;
        }
        /*顶部按钮*/
        .btn-custom1 ,
        .btn-custom2 {
            background-color: #a6cfa6;
            color: white;
            border: none;
        }
        /* 自定义搜索表单样式 */
        .custom-form .input-group {
            max-width: 500px;
            /*margin: auto;*/
            margin-left: 20px;
        }

        .custom-form .input-group .form-control .custom-select  {
            border-top-left-radius: 25px;
            border-bottom-left-radius: 25px;
        }

        .custom-form .input-group .btn {
            border-top-right-radius: 25px;
            border-bottom-right-radius: 25px;
            background-color: #d4edda; /* 浅绿色 */
            color: #000000;
        }

        .custom-form .input-group .btn:hover {
            background-color: #479658;
        }
        /*表格交叉色*/
        .table-striped-custom tbody tr:nth-of-type(odd) {
            background-color: #ecf6f0; /* 浅绿色背景 */
        }
        /* 定义箭头的样式 */
        .page-link {
            color: #98c4a2; /* 浅绿色 */
        }
    </style>
</head>

<body>
<!--引入抽取的topbar-->
<!--模板名：会使用thymeleaf的前后缀配置规则进行解析-->
<div th:replace="commons/admbar::topbar"></div>
<div class="container-fluid">
    <div class="row">
        <!--引入侧边栏-->
        <div th:replace="commons/admbar::#sidebar(activeUri='class')"></div>

        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <h2>
                <a class="btn btn-custom1" href="emp" th:href="@{/adm/classadd}">添加班级</a>
<!--                <a style="float: right" class="btn btn-custom2" href="" th:href="@{/adm/toclassdmin/1}">全部班级</a>-->
            </h2>
            <form method="get" th:action="@{/adm/selectClassByName}" class="custom-form my-4">
                <div class="input-group mb-3">
<!--                    <input type="text" class="form-control"  name="className" placeholder="请输入班级名" aria-label="请输入班级名" aria-describedby="button-addon2">-->
                    <div class="input-group-append" >
                        <button  class="btn btn-outline-secondary" type="submit" id="button-addon2">查询</button>
                    </div>
                </div>
            </form>


            <div class="table-responsive">
                <table class="table table-striped table-sm table-sm table-striped-custom">
                    <thead>
                    <tr>
                        <th>班级编号</th>
                        <th>班级名</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="class:${pageInfo.list}" th:if="tea!=null" >
                        <td th:text="${class.classId}"></td>
                        <td th:text="${class.className}"></td>
                        <td>
                            <a href="#" title="编辑" th:href="@{/adm/class/}+${class.classId}"><i class="fas fa-pencil-alt custom-icon" style="color:#6fab79;margin-right: 10px"></i></a> <!-- 使用Font Awesome图标 -->
                            <a href="#" title="删除" th:attr="del_uri=@{/adm/class/}+${class.classId}"><i class="fas fa-times deleteBtn" style="color:#6fab79;"></i></a> <!-- 使用Font Awesome图标 -->
<!--                            <a class="btn btn-sm btn-primary" th:href="@{/adm/class/}+${class.classId}">编辑</a>-->
<!--                            <button th:attr="del_uri=@{/adm/class/}+${class.classId}" class="btn btn-sm btn-danger deleteBtn">删除</button>-->
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>

            <!--分页信息-->
            <nav aria-label="Page navigation example" >
                <ul class="pagination justify-content-center"  >
                    <li class="page-item"><a class="page-link" href="#" th:href="@{/adm/toclassdmin/1}"> << </a></li>
                    <li class="page-item" th:classappend="${pageInfo.hasPreviousPage}?'':' disabled'">
                        <a class="page-link" href="#" th:href="@{/adm/toclassdmin/}+${pageInfo.pageNum-1}" tabindex="-1" aria-disabled="true"> ← </a>
                    </li>

                    <li class="page-item"  th:each="page_Num:${pageInfo.navigatepageNums}" >
                        <a class="page-link"  th:text="${page_Num}" th:href="@{/adm/toclassdmin/}+${page_Num}"  th:if="${page_Num}==${pageInfo.pageNum}" th:style="'font-weight:bold;'">1</a>
                        <a class="page-link"  th:text="${page_Num}" th:href="@{/adm/toclassdmin/}+${page_Num}"  th:if="${page_Num}!=${pageInfo.pageNum}" >1</a>
                    </li>

                    <li class="page-item" th:classappend="${pageInfo.hasNextPage}?'':' disabled'">
                        <a class="page-link" href="#" th:href="@{/adm/toclassdmin/}+${pageInfo.pageNum+1}"> → </a>
                    </li>
                    <li class="page-item"><a class="page-link" href="#" th:href="@{/adm/toclassdmin/}+${pageInfo.pages}"> >> </a></li>
                </ul>
            </nav>



        </main>
        <form id="deleteEmpForm"  method="post">
            <input type="hidden" name="_method" value="delete"/>
        </form>
    </div>
</div>


<script type="text/javascript" src="/helps/js/jquery-3.7.1.min.js" ></script>
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script type="text/javascript" src="/plugins/bootstrap-4.0.0/js/bootstrap.min.js" ></script>

<!-- Icons -->
<script type="text/javascript" src="/helps/js/feather.min.js" ></script>
<script>
    feather.replace()
</script>
<script>
    $(".deleteBtn").click(function(){
        //删除当前员工的
        var i=confirm("你确定要删除吗?");
        if(i==true)
        {
            $("#deleteEmpForm").attr("action",$(this).attr("del_uri")).submit();
            return false;
        }
        else {
            return false;
        }

    });
</script>
</body>
</html>